const http = uni.$u.http

// post请求，默认请求添加token
export const postApi = (params, header) => http.post('/api/v1/index', params,{"custom": {auth: true,toast: false, catch: false,params: {},header : header}})
// get请求，默认请求添加token
export const getApi = (params, header) => http.get('/api/v1/index', {"custom": {"auth": true},params, header})

// ================================== INDEX ===================================== 

//底部菜单
export const indexTabbar = (params, header) => http.get('/api/v1/index/indexTabbar', {"custom": {"auth": true},params, header})
//token登录
export const tokenLogin = (params, header) => http.get('/api/v1/login/tokenLogin', {"custom": {"auth": true,toast: false},params, header})
//广告列表查询
export const storeAdvertisingList = (params, header) => http.post('/api/v1/location/locationListById',  params,{"custom": {"auth": true},header})

//============================== LOGIN ===================================== 
//获取验证码
export const smsCode = (params, type) => http.post('/api/v1/common/smsCode', params,type,{"custom": {"auth": true}})
//账号注册
export const accountRegister = (params, header) => http.post('/api/v1/login/accountRegister', params,{"custom": {"auth": true},header})
//账号登录
export const accountLogin = (params, header) => http.post('/api/v1/login/accountLogin', params,{"custom": {"auth": true},header})
//手机登录
export const phoneLogin = (params, header) => http.post('/api/v1/login/login', params,{"custom": {"auth": true}, header})
//退出登录
export const logout = (params, header) => http.post('/api/v1/login/logout', params,{"custom": {auth: true,toast: false, catch: false,params: {},header : header}})
//退出登录
export const getWxOpenId = (params, header) => http.get('/api/v1/login/getWxOpenId', {"custom": {"auth": true},params, header})
// 找回密码
export const findPassWord = (params, header) => http.post('/api/v1/login/findPassword', params,{"custom": {"auth": true},header})
// 微信登陆
export const weixinLogin = (params, header) => http.get('/api/v1/login/getWxOpenId', {"custom": {"auth": true},params, header})
// 自动登录
export const autoLogin = (params, header) => http.get('/api/v1/login/tokenLogin', {"custom": {"auth": true},params, header})


// =============================== Me =========================================
// 上传文件
export const uploadFile = (params,header) => http.post('/api/v1/common/uploadFile',params,{"custom": {"auth": true},header})
// 修改信息
export const updateMember = (params,header) => http.post('/api/v1/member/updateMember',params,{"custom": {"auth": true},header})
// 新增收货地址
export const addAddress = (params,header) => http.post('/api/v1/member/address/insert',params,{"custom": {"auth": true},header})
// 获取列表地址
export const getAddress = (params,header) => http.post('/api/v1/member/address/list',params,{"custom": {"auth": true},header})
// 删除地址
export const deletAddress = (params, header) => http.get(`api/v1/member/address/delete/${params}`, {"custom": {"auth": true}, header})
// 获取地址信息
export const getAddressInfo = (params, header) => http.get(`api/v1/member/address/${params}`, {"custom": {"auth": true}, header})
// 编辑地址
export const editAddress = (params,header) => http.post('/api/v1/member/address/edit',params,{"custom": {"auth": true},header})
// 设为默认
export const setMoRen = (params,header) => http.get('/api/v1/member/address/updateDef',{"custom": {"auth": true},params,header})
// 实名认证
export const RealName = (params,header) => http.get('/api/v1/member/authentication',{"custom": {"auth": true},params,header})
// 获取地区
export const getAreaList = (params,header) => http.get('/api/v1/common/storeToolAreaList',{"custom": {"auth": true},params,header})